<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>9 - Migrating to OpenBSD</title>
<link rev="made" href= "mailto:www@openbsd.org">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name= "resource-type" content= "document">
<meta name= "description"   content= "the OpenBSD FAQ page">
<meta name= "keywords"      content= "openbsd,faq">
<meta name= "distribution"  content= "global">
<meta name= "copyright"     content= "This document copyright 1998-2007 by OpenBSD.">
</head>

<body bgcolor= "#ffffff" text= "#000000">
<!-- Passes validator.w3.org, please keep it this way;
please, use a max of 72 chars per line -->

<a href="../index.html">
<img alt="[OpenBSD]" height=30 width=141 src="../images/smalltitle.gif" border="0">    
</a>
<p>
<font color= "#0000e0">
<a href= "index.html">[FAQ Index]</a>
<a href= "faq8.html">[To Section 8 - General Questions]</a>
<a href= "faq10.html">[To Section 10 - System Management]</a>
</font>

<h1><font color="#e00000">9 - Migrating to OpenBSD</font></h1>
<hr>

<p>
<h3>Table of Contents</h3>
<ul>
<li><a href= "#Introduction">9.1 - Tips for users of other Unix-like
Operating Systems</a>
<li><a href= "#DualBoot">9.2 - Dual boot of Linux and OpenBSD</a>
<li><a href= "#passwd">9.3 - Converting your Linux (or other Sixth
Edition-style) password file to BSD-style.</a>
<li><a href= "#Interact">9.4 - Running Linux binaries on OpenBSD</a>
<li><a href= "#Ext2FS">9.5 - Accessing your Linux files from OpenBSD</a>
</ul>

For more information for Linux users, please refer to <a href="http://sites.inka.de/mips/unix/bsdlinux.html">http://sites.inka.de/mips/unix/bsdlinux.html</a>.
<hr>
<br>


<p>
<a name= "Linux"></a>
<a name="Introduction"></a>
<h2>9.1 - Tips for users of other Unix-like Operating Systems</h2>

<p>
While OpenBSD is a very traditional Unix-like operating system and will
be very familiar to those who have used other Unix-like systems, there
are important differences.
New users to OpenBSD must look at their own experience:
if your only knowledge of Unix is some experience with one variant
of Linux, you may find OpenBSD "strange".
Rest assured, Linux looks pretty strange to anyone who starts from
OpenBSD.
You must recognize the difference between "standard" and your
experience.

<p>
If you learned Unix from any of the <a href="../books.html">good
books</a> on general Unix, understanding the "Unix philosophy"  and then
extended your knowledge to a particular platform, you will find OpenBSD
to be a very "true" and familiar Unix.
If you learned Unix using a "type this to do that" process or a book
such as "Learn PinkBeenie v8.3 in 31.4 Hours", and told yourself you
"know Unix", you will most likely find OpenBSD very different.

<p>
One important difference between OpenBSD and many other operating systems
is the documentation.  OpenBSD developers take great pride in the system
<a href="http://www.openbsd.org/cgi-bin/man.cgi">man pages</a>.
The man pages are <i>the</i> authoritative source of OpenBSD
documentation -- not this FAQ, not third-party independently maintained
pages, not "HOWTO"s, etc.
When a developer makes a change to the system, they are expected to
update the man pages along with their change to the system code, not
"later" or "when they get around to it" or "when someone complains".
A manual page exists for virtually every program, utility, driver, 
configuration file, and so on on the stock system.
It is expected that a user will check the man pages before asking for
help on the <a href="../mail.html">mail lists</a>.

<p>
Here are some of the commonly encountered differences between OpenBSD
and other Unix variants.

<ul>
<li>OpenBSD is a fairly pure "BSD-Style" Unix, following the 4.4BSD
design closely.
Linux and SCO Unix are "System V" style systems.
Some Unix-like operating systems (including some Linux distributions)
mix many SysV and BSD characteristics.
A common place where this causes confusion is the 
<a href="faq10.html#rc">startup scripts</a>, OpenBSD uses the
traditional BSD4.4-style 
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=rc&amp;sektion=8">rc(8)</a>
style.

<li>OpenBSD is a complete <i>system</i>, intended to be kept in sync.  
It is not a "Kernel plus utilities" that can be upgraded separately
from each other.
Failure to keep your system (kernel, user utilities, and applications)
in sync will result in bad things happening.

<li>As many applications are not developed to directly compile and run
on an OpenBSD environment, OpenBSD has a
<a href="faq15.html#Ports">ports tree</a>, a system where users can
easily acquire code, patch it for OpenBSD, install dependencies, compile
it, install and remove it in a standardized and maintainable way.
Pre-compiled <a href="faq15.html#PkgMgmt">packages</a> are created and
distributed by the OpenBSD ports team.
Users are <a href="faq15.html#PkgVsPorts">encouraged</a> to use these
packages over compiling their own.

<li>OpenBSD uses CVS to keep track of source code changes.
OpenBSD pioneered <a href="../anoncvs.html">anonymous CVS</a>, which
allows anyone to extract the full source tree for any version of OpenBSD
(from 2.0 to current, and all revisions of all files in between) at any
time, and you can access the most recent changes within hours of its
commit.
There is also a very convenient and easy to use
<a href="http://www.openbsd.org/cgi-bin/cvsweb/">web interface to
CVS</a>.

<li>OpenBSD produces an official release available on <a
href="../orders.html">CD</a> and <a href="../ftp.html">FTP</a> every six
months on a <a href="faq1.html#Next">predefined schedule</a>.
Snapshots for all supported platforms are made semi-regularly with the
current development code.
It is the goal that the source tree is kept fully buildable and the
resultant system usable at all times.
The tree is occasionally broken, but this is an extraordinary event that
will be corrected rapidly, not something that will be permitted to
continue.

<li>OpenBSD contains <a href="../crypto.html">strong cryptography</a>,
which can not be included with OSs based in some countries.

<li>OpenBSD has gone through heavy and continual security auditing to
ensure the quality (and thus, security) of the code.

<li>OpenBSD's kernel is <tt>/bsd</tt>.

<li>The names of hard disks are usually <tt>/dev/wd</tt> (IDE) and
<tt>/dev/sd</tt> (SCSI or devices emulating SCSI disks).

<li><a href="http://www.openbsd.org/cgi-bin/man.cgi?query=route&amp;sektion=8">/sbin/route</a>
with no arguments in Linux gives the state of all the active routes,
under OpenBSD (and many other OSs), you need the "<i>show</i>"
parameter, or do a
"<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=netstat&amp;sektion=1"><tt>netstat -r</tt></a>".

<li>OpenBSD does NOT support Journaling Filesystems like ReiserFS, IBM's
JFS or SGI's XFS.
Instead we use the <a href="faq14.html#SoftUpdates">Soft Updates</a> feature
of the already very robust Unix Fast File System (FFS) to accomplish the
goals of performance and stability.

<li>OpenBSD comes with <a href="pf/index.html">Packet Filter (PF)</a>,
not ipfw, ipchains, netfilter, iptables, or ipf.  This means that
Network Address Translation (known as IP-Masquerading in Linux), 
queuing, and filtering is done through
<a href= "http://www.openbsd.org/cgi-bin/man.cgi?query=pfctl&amp;sektion=8">pfctl(8)</a>,
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pf&amp;sektion=4">pf(4)</a>, and
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pf.conf&amp;sektion=5">pf.conf(5)</a>.
See the <a href="pf/index.html">PF User's Guide</a> for detailed
configuration information.

<li>Interface address is stored in
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=hostname.if&amp;sektion=5">/etc/hostname.&lt;interfacename&gt;</a>
(for example, <tt>/etc/hostname.dc0</tt> for a NIC using the 
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=dc&amp;sektion=4">dc(4)</a>
driver).
It can contain hostname (resolved in 
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=hosts&amp;sektion=5">/etc/hosts</a>)
instead of an IP address.

<li>The machine name is in
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=myname&amp;sektion=5">/etc/myname</a>.

<li>The default gateway is in 
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=mygate&amp;sektion=5">/etc/mygate</a>.

<li>OpenBSD's default shell is
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=ksh&amp;sektion=1">/bin/ksh</a>,
which is <a href="http://web.cs.mun.ca/~michael/pdksh/">pdksh</a>, the
Public Domain Korn shell.
Other included shells are
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=csh&amp;sektion=1">csh</a>
and
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=sh&amp;sektion=1">sh</a>.
Shells such as <i>bash</i> and <i>tcsh</i> can be added as
<a href="faq15.html#PkgMgmt">packages</a> or installed from  
<a href="faq15.html#Ports">ports</a>.
Users familiar with <i>bash</i> are encouraged to
<a href="faq10.html#ksh">try ksh(1)</a> before loading <i>bash</i> on their
system -- it does what most people desire of <i>bash</i>.

<li>Password management on OpenBSD is different from password management
on some other Unix-like operating systems.
The actual passwords are stored in the file
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=master.passwd&amp;sektion=5">master.passwd(5)</a>
which is readable only by <i>root</i>.
This file should be altered only with the
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=vipw&amp;sektion=8">vipw</a>
program.

<li>Devices are named by driver, not by type. For example, there are
no eth* devices. It would be ne0 for an NE2000 Ethernet card, and xl0
for a 3Com Etherlink XL or a Fast Etherlink XL Ethernet device, etc.
All of these drivers have man pages in section 4.
So, to find more information about the messages your 3c905 driver is
putting out, you can do
"<tt><a href="http://www.openbsd.org/cgi-bin/man.cgi?query=xl&amp;sektion=4">man
4 xl</a></tt>".

<li>OpenBSD/i386, amd64, and several other platforms use a "two layer"
disk partitioning system, where the first layer is the
<a href="faq14.html#fdisk">fdisk</a>, BIOS-visible partition, familiar
to most users of IBM compatible computers.
The second layer is the <a href="faq14.html#disklabel">disklabel</a>,
a traditional BSD partitioning system.
OpenBSD supports up to 15 disklabel partitions on a disk, all residing
within one fdisk partition.
This permits OpenBSD to coexist with other OSs, including other
Unix-like OSs.
OpenBSD must be one of the four "primary" partitions.

<li>Some other OSs encourage you to customize your kernel for your
machine.
OpenBSD users are <a href="faq5.html#Why">encouraged</a> to simply use
the standard GENERIC kernel provided and tested by the developers.
Users attempting to "customize" or "optimize" their kernel usually
cause far more problems than they solve, and will not be supported
by developers.

<li>OpenBSD works hard to maintain the <a href="../policy.html">license
policy</a> and <a href="../security.html">security</a> of the project.
For this reason, some newer versions of some software which fail to meet
either the license or security goals of the project have not and may
never be integrated into OpenBSD.
Security and free licensing will never take a back seat to having the 
biggest version number.

</ul>

<p>
<a name= "DualBoot"></a>
<h2>9.2 - Dual booting Linux and OpenBSD</h2>

<p>
Yes! It is possible!

<p>
Read <a href= "ftp://ftp.openbsd.org/pub/OpenBSD/4.3/i386/INSTALL.linux">INSTALL.linux</a>.

<p>
<a name= "passwd"></a>
<h2>9.3 - Converting your Linux (or other Sixth Edition-style) password file
to BSD-style</h2>

<p>
First, figure out if your Linux password file is shadowed or not.  If it
is, install <a href="http://www.openwall.com/john/">John the Ripper</a> from
<a href="faq15.html">packages or ports</a> (<tt>security/john</tt>) and
use the unshadow utility that comes with it to merge your
<tt>passwd</tt> and <tt>shadow</tt> files into one Sixth Edition-style file.

<p>
Using your Linux password file, we'll call it <tt>linux_passwd</tt>, you
need to add in ::0:0 between fields four and seven.
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=awk&amp;sektion=1">awk(1)</a>
does this for you.

<blockquote>
<pre>
# <b>cat linux_passwd | awk -F : '{printf("%s:%s:%s:%s::0:0:%s:%s:%s\n", \</b>
&gt; <b>$1,$2,$3,$4,$5,$6,$7); }' &gt; new_passwd</b>
</pre>
</blockquote>

At this point, you want to edit the <tt>new_passwd</tt> file and remove
the root and other system entries that are already present in your
OpenBSD password file or aren't applicable with OpenBSD (all of them).
Also, make sure there are no duplicate usernames or user IDs between
<tt>new_passwd</tt> and your OpenBSD box's <tt>/etc/passwd</tt>.  The
easiest way to do this is to start with a fresh <tt>/etc/passwd</tt>.

<blockquote>
<pre>
# <b>cat new_passwd &gt;&gt; /etc/master.passwd</b>
# <b>pwd_mkdb -p /etc/master.passwd</b>
</pre>
</blockquote>

The last step, <tt>pwd_mkdb</tt> is necessary to rebuild the
/etc/spwd.db and /etc/pwd.db files.  It also creates a Sixth Edition-style
password file (minus encrypted passwords) at /etc/passwd for programs
which use it.  OpenBSD uses a stronger encryption for passwords,
blowfish, which is very unlikely to be found on any system which uses
full Sixth Edition-style password files.  To switch over to this stronger
encryption, simply have the users run 'passwd' and change their
password.  The new password they enter will be encrypted with your
default setting (usually blowfish unless you've edited
/etc/login.conf).  Or, as <i>root</i>, you can run <tt>passwd
<i>username</i></tt>.


<p>
<a name= "Interact"></a>
<h2>9.4 - Running Linux binaries on OpenBSD</h2>

<p>
OpenBSD/i386 is able to run Linux binaries when the kernel is compiled
with the COMPAT_LINUX option and the runtime sysctl kern.emul.linux is
also set.
If you are using the GENERIC kernel (which you should be), COMPAT_LINUX
is already enabled, and you will just need to do:

<blockquote>
<pre>
# <b>sysctl kern.emul.linux=1</b>
</pre>
</blockquote>

For this to be done automatically each time the computer boots,
remove the # (comment) character at the beginning of the line

<blockquote>
<pre>
#kern.emul.linux=1      # enable running Linux binaries
</pre>
</blockquote>

in /etc/sysctl.conf, so that it reads

<blockquote>
<pre>
kern.emul.linux=1       # enable running Linux binaries
</pre>
</blockquote>

and reboot your system to have it take effect.

<p>
To run any Linux binaries that are not statically linked (most of them),
you need to follow the instructions on the 
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=compat_linux&amp;sektion=8">compat_linux(8)</a> 
manual page.

<p>
A simple way to get most of the useful Linux libraries is
to install the <tt>fedora/base</tt> package from your nearest FTP mirror.
To find out more about the packages and ports system read
<a href="faq15.html">FAQ 15 - The OpenBSD Packages and Ports System</a>.
To install the above mentioned package you would issue

<blockquote><pre>
# export PKG_PATH=ftp://your.ftp.mirror/pub/OpenBSD/4.3/packages/i386/
# pkg_add -i fedora_base
</pre></blockquote>

Note that
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pkg_add&amp;sektion=1">pkg_add(1)</a>
will automatically execute sysctl to set kern.emul.linux to the correct
value upon adding this package.
However, it does not change <tt>/etc/sysctl.conf</tt>, so if you wish
Linux emulation to be enabled by default, you need to modify
kern.emul.linux there.


<p>
<a name= "Ext2FS"></a>
<h2>9.5 - Accessing your Linux files from OpenBSD</h2>

<p>
OpenBSD supports the EXT2FS file system. 
For further information, see <a href="faq14.html#foreignfs">FAQ 14</a>.


<p>
<font color= "#0000e0">
<a href= "index.html">[FAQ Index]</a>
<a href= "faq8.html">[To Section 8 - General Questions]</a>
<a href= "faq10.html">[To Section 10 - System Management]</a>
</font>

<p>
<hr>
<a href= "index.html"><img height= "24" width= "24" src= "../images/back.gif" border= "0" alt= "[back]"></a>
<a href= "mailto:www@openbsd.org">www@openbsd.org</a>
<br>
<small>$OpenBSD: faq9.html,v 1.90 2008/04/30 21:24:58 nick Exp $</small>
</body>
</html>
